<template>
  <div id="app" class="app-page">
    <root>
      <safe-header
        v-bind="{
          title: '源单查询',
          isBack: true,
          backIconColor: '#fff',
          fixedTop: true,
        }"
      />
      <div>

        <!--列表-->
        <v-container width:80%>
          <v-card
            class="mx-auto my-2 list_card"
            max-width="374"
            v-for="item in inventoryOrderList"
            :key="item.code"
            outlined
            style="board: thin solid #cacbcc"
          >


            <v-card-text>
              <v-row >
                <v-col cols="3" class="py-1"  style="color: #999999"   @click="warehouseOrderClick(item)">出库单号</v-col>
                <v-col class="ms-2 py-1 text-right" style="font-size: 0.75rem; color: #666666">
                  {{ item.billNo }}
                </v-col>
              </v-row>



              <v-row class="d-flex flex-row justify-space-between">
                <v-col cols="4" class="py-1 card-lable">供应商</v-col>
                <v-col class="ms-2 py-1 text-right card-value">
                  {{ item.supplier }}
                </v-col>
              </v-row>

              <v-row>
                <v-col cols="3" class="py-1" style="color: #999999">创建人</v-col>
                <v-col class="ms-2 py-1 text-right" style="font-size: 0.75rem; color: #666666">
                  {{ item.createUserName }}
                </v-col>
              </v-row>

              <v-row class="d-flex flex-row justify-space-between">
                <v-col cols="3" class="py-1 card-lable">创建日期</v-col>
                <v-col class="ms-2 py-1 text-right card-value">
                  {{ item.createTime }}
                </v-col>
              </v-row>
            </v-card-text>
          </v-card>
        </v-container>


      </div>
    </root>
  </div>
</template>

<script>
  import SafeHeader from "../../components/safeHeader_wms";
  import Storage from "@/utils/storage.js";
  import wms from "../../utils/http.js";
  import { apiList } from "@/static/apiList";
  import { mdiChevronRight, mdiMagnify } from "@mdi/js";
  import Root from "@/components/Root.vue";

  export default {
    name: "Inventory_OrderList",
    components: {
      SafeHeader,
      Root,
    },
    data() {
      return {
        showList:true,
        showEmpty:true,
        list: [],
        svgpath: mdiChevronRight,
        mdiMagnify: mdiMagnify,
        value: "",
        infoList: [],
        inventoryOrderList: [],
      };
    },
    computed: {},
    methods: {

      //点击盘点单号携带单号跳转盘点任务页面(inventory)回显参数
      warehouseOrderClick(item) {
        console.log(`----------------------------------------${item.billNo}`);
        if (window.navigator.userAgent.toLowerCase().includes("apicloud")) {
          window.api.sendEvent({
            name: "RawMaterialsOutManage",
            extra: {
              billNo: item.billNo,
            },
          });
          window.api.openWin({
            name: "RawMaterialsOutManage",
            url: "./RawMaterialsOutManage.html",
            pageParam: {
              billNo: item.billNo,
            },
          });
        } else {
          this.$root.api.api.sendEvent({
            name: "RawMaterialsOutManage",
            extra: {
              billNo: item.billNo,
            },
          });
          this.$root.api.api.openWin({
            name: "RawMaterialsOutManage",
            url: "./RawMaterialsOutManage.html",
            pageParam: {
              billNo: item.billNo,
            },
          });
        }
      },
    },
    mounted() {
      let params = {
        wareId: Storage.getObject("loginConfig").wareIds[0],
        asnState: 0,
        insertType: 0,
        asnType: 24,
      };
      wms.get({ url: "/stock/take/masters/list", data: params }).then((res) => {
        console.log(res);
        this.infoList = res.data.data.list;
        let asnStates = apiList.asnStates;
        this.infoList.forEach((item) => {
          asnStates.forEach((val) => {
            if (item.asnState == val.value) {
              item.statesLabel = val.label;
            }
          });
        });
        this.inventoryOrderList = this.infoList;
      });
    },
  };
</script>

<style lang="scss" scoped>
  .line{
    border: 1px solid #f4f1f9;
  }
</style>
